<!-- Portfolio Grid Section -->
<section id="portfolio" class="bg-light-gray" style="margin-top:-110px;">
    <div class="container">
                        <div class="row">
                                          
                   



     <?php $endl = 1;
            $id = 0;
      ?>       
        
            <?php foreach($records as $row) {

                       if($endl%4==0)
                       echo "<div class='row'>"; 
                        ?>
                        <div class="col-md-3 col-sm-4 portfolio-item">
                            <a href="#portfolioModal<?php echo $id; ?>" class="portfolio-link" data-toggle="modal">
                                <div class="portfolio-hover">
                                    <div class="portfolio-hover-content">
                                        <i class="fa fa-plus fa-3x"></i>
                                    </div>
                                </div>
                                <div style="height:170px; overflow:hidden; border: 1px solid; border-color:#e0e0e0; background:#e0e0e0;">
                                    <center>
                                        <img src='<?php echo $row->img_1; ?>'  class="img-responsive" alt="">
                                    </center>
                                </div>
                            </a>
                            <div class="portfolio-caption">
                                <h4><?php echo $row->ad_title; ?></h4>
                                <p class="text-muted"><a href="#" class="btn btn-primary">Approve</a>
                                	&nbsp;<a href="#" class="btn btn-danger">Delete</a></p>
                            </div>
                        </div>



                        <?php
                        if($endl % 4 ==0)
                            echo "</div>";

                        $endl++;
                        $id++; 

                         }
              ?> 
  

    </div>
</section>


<!-- modals -->
<?php 
$i=0;
foreach($records as $row) { 
    if($row->active ==2){
    ?>

    <div class="portfolio-modal modal fade" id="portfolioModal<?php echo $i; ?>" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-content">
            <div class="close-modal" data-dismiss="modal">
                <div class="lr">
                    <div class="rl">
                    </div>
                </div>
            </div>
            <div class="container">
                <div class="row">
                    <div class="col-lg-8 col-lg-offset-2">
                        <div class="modal-body">
                            <!-- Project Details Go Here -->
                            <h2><?php echo $row->ad_title; ?></h2>
                                
                                                            
                            <br>

                            <div class="row">
                                <div class="col-md-12">
                                    <center>
                                     <img class="img-responsive" data-toggle="magnify" src='<?php echo $row->img_1; ?>' alt="">
                                     </center>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-6">
                                    <center>
                                    <img class="img-responsive"   src='<?php echo $row->img_2; ?>' alt="">
                                    </center>
                                </div>
                                <div class="col-md-6">
                                    <center>
                                    <img class="img-responsive" src='<?php echo $row->img_3; ?>' alt="">
                                    </center>
                                </div>
                            </div>
      
                            
                            <h3>Discription:</h3>
                            <p><?= $row->disc; ?></p>
                            
                            <p><strong>Contact #:</strong><?= $row->contact; ?></p>
                            <br><br>
                            
                            <ul class="list-inline">
                                <li><p><b>Date:</b> <?= $row->timestamp; ?></p></li>
                                <li><p><b>Price: </b><?= $row->price; ?>Rs</p></li>
                            </ul>
                            <ul class="list-inline">
                                <li><p><b>Keywords:</b><?= $row->keywords ?></p></li>
                                
                            </ul>
                            
                            <button type="button" class="btn btn-primary" data-dismiss="modal"><i class="fa fa-times"></i>Close</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

        <?php 
        $i++;
    }
} ?>